import 'package:flutter/material.dart';

/// 工具类全局配置
class UtilGlobal {
  /// 全局GlobalKey<NavigatorState>
  static GlobalKey<NavigatorState> get key {
    assert(_key.currentState != null, '请调用 UtilGlobal.addKey()');
    return _key;
  }

  static GlobalKey<NavigatorState> _key = GlobalKey<NavigatorState>(debugLabel: 'Key Created by default');

  /// 设置全局GlobalKey<NavigatorState>
  static GlobalKey<NavigatorState> setKey(GlobalKey<NavigatorState> key) {
    UtilGlobal._key = key;
    return _key;
  }
}
